<!--suppress ALL -->
<include file="./Template/header.html" />

<link rel="stylesheet" type="text/css" href="/Template/css/applyWithdraw.css">
<script type="text/javascript">

	$(function() {

		//初始化页面配置
		initPage("申请提现", "center");

		var app = new Vue({
			el: '#container',
			data: {
				eventList: [],
			},
			methods: {
				index: indexPage,
				order: orderPage,
				rank: rankPage,
				center: centerPage,
				apply: function() {

					var money = $("input[name=money]").val();

					if(money <= 0) {
						alert("提现金额必须大于零");
						$("input[name=money]").val("");
						return false;
					}

					if(money < 1) {
						alert("提现金额必须大于一元");
						$("input[name=money]").val("");
						return false;
					}

					if(!/^\d+(\.\d{1,2})?$/.test(money)) {
						alert("提现的最小单位只能到分，请重新填写");
						$("input[name=money]").val("");
						return false;
					}

					$.ajax({
						url:"/wechat/userCenter/apply",
						type:"post",
						data:{
							money:money,
						},
						dataType:"JSON",
						beforeSend:function(){
							$("#loadingToast").show();
						},
						complete:function(){
							$('#loadingToast').hide();
						},
						success:function(data){
							if(data.code!=200) {
								alert(data.msg);
							} else {
								alert("提现成功");
							}
							window.location.href = "/wechat/userCenter/myWallet";
						},
					})

				}
			}
		})

	});


</script>

<div class="apply-withdraw">
	<p class="title color-99">请输入提现金额</p>
	<div class="money color-66"></div>
	<input type="number" class="input-money" name="money" />
	<div class="apply-btn" v-on:click="apply">
		<p>立即申请</p>
	</div>
</div>

<include file="./Template/footer.html" />